<?php
//声明命名空间
namespace Home\Controller;
//引用父类控制器
use Think\Controller;

class MindTestMainController extends Controller{
	public function MindMain(){
		//获取传过来的id
		$test_id = $_GET['id'];
		//提取数据库中的测试类型
        $modelTest = M('Test');
        $modelSelect = M('Select');
        $modelType = M('type');

        //查询类型库
        $arrTest = $modelTest -> select();
        $arrSelect = $modelSelect -> select();
        $arrType = $modelType -> select();
        //获取当前测试的详细介绍
        $this_test = $arrTest[$test_id-1];
        //获取上一次的浏览次数
        $n = (int)$arrTest[0]['browse'];
        $n = $n+1;
        $modelTest -> id = 1;
        $modelTest -> browse = $n;
        $three = $modelTest -> save();
        
       	//替换
        $this -> assign('this_test',$this_test);
        $this -> assign('arrSelect',$arrSelect);
        $this -> assign('arrType',$arrType);
		//注销
      	$this -> assign('zuxiao',session('zuxiao'));
		$this -> assign('thisLoginName',session('thisLoginName'));
		$this -> display();
	}
}
?>